import { app, remote } from 'electron'
import fs from 'fs-extra'
import path from 'path'

const APP = process.type === 'renderer' ? remote.app : app
const storePath = APP.getPath('userData')
const avatarPath = path.join(storePath, 'Avatar')

if (process.type !== 'renderer') {
  if (!fs.pathExistsSync(storePath)) {
    fs.mkdirpSync(storePath)
  }
  if (!fs.pathExistsSync(avatarPath)) {
    fs.mkdirpSync(avatarPath)
  }
}

export const STORE_PATH = storePath
export const AVATAR_PATH = avatarPath
